namespace php Services.AuctionService
namespace go Services.AuctionService
namespace java Services.AuctionService

exception InvalidException {
    1: i32 code
    2: string message
}


struct BidMsg {
    1: i32 code,
    2: string message
}

struct BiddingMsg {
        1:  i64     orderId,    //拍单ID
        2:  i64     dealerId,   //车商ID
        3:  double  orgPrice,   //基价
        4:  double  addPrice,   //加价
        5:  double  price,      //出价（自定义出价）
        6:  i64     devType,    //出价设备类型
        7:  bool    isAuto,     //是否智能出价
        8:  i64     biddingTime //出价时间(毫秒)
}

struct LastAutoBiddingInfoMsg {
        1: i64 dealerId         //车商ID
        2: i64 orderId          //拍单ID
        3: double limitPirce    //限制出价
        4: i64 status           //状态
        5: i64 createtime       //创建时间
}


struct inParamsCreateEditScene {
        1:required string name          //场次名称
        2:required i64 starttime        //开场时间
        3:required i64 branchId         //所属分公司
        4:required i64 city             //所属城市
        5:optional i64 sceneActivity    //场活动
        6:optional i64 empId            //员工ID
        7:optional i64 sceneId          //场ID
}

struct inParamsCreateOrder {
        1:required i64 carId                //上拍车辆
        2:required i64 sceneId               //上拍场次
        3:required i64 estElapsedTime        //竞拍时长
        4:required double bidStartPrice      //起拍价
        5:required double transferFee        //交付服务费
        6:optional i64 biddingStartTime      //竞拍开始时间
        7:optional i64 coupon                //代金券
        8:optional bool showReservePrice     //是否显示保留价
        9:optional i64 empId                //上拍人
}

struct OrderSceneMsg{
    1:required i64 orderId
    2:required i64 biddingStartTime
    3:required i64 estElapsedTime
    4:required i64 actElapsedTime
    5:required i64 isTimingOrder
    6:required i64 sceneId
    7:required i64 sceneStartTime
}

struct inParamsBidding{
    1:required i64 dealerId         //车商ID
    2:required i64 orderId          //拍单ID
    3:optional double basePrice     //基价
    4:optional double addPrice      //加价
    5:optional double price         //出价（自定义出价）
    6:required i32 deviceType       //设备类型(0,web 1,android 2,ios)
    7:required i32 isAuto           //是否智能出价
}

service AuctionService{
    /**
     * 投标出价
     *
     * @param i64 dealerId 车商ID
     * @param i64 orderId 拍单ID
     * @param double price 投标出价
     * @param i32 deviceType 设备类型(0,web 1,android 2,ios)
     * @return  bool
     *
     */
    BidMsg bid(1:i64 dealerId, 2:i64 orderId, 3:double price, 4:i32 deviceType) throws (1:InvalidException ex),

    /**
     * 竞标出价
     * @param inParamsBidding inParams 参数结构体
     * @return  bool
     *
     */
    bool bidding(1:inParamsBidding inParams) throws (1:InvalidException ex),

    /**
     * 设置智能出价
     *
     * @param i64 dealerId 车商ID
     * @param i64 orderId 拍单ID
     * @param double limitPrice 限制出价
     * @return  bool
     *
     */
    bool intelBidSet(1:i64 dealerId, 2:i64 orderId, 3:double limitPrice) throws (1:InvalidException ex),

    /**
     * 停止智能出价
     *
     * @param i64 dealerId 车商ID
     * @param i64 orderId 拍单ID
     * @return  bool
     *
     */
    bool intelBidStop(1:i64 dealerId, 2:i64 orderId) throws (1:InvalidException ex),


    /**
     * 智能出价
     *
     * @param i64 dealerId 车商ID
     * @param i64 orderId 拍单ID
     * @param double basePrice 基价
     * @param double addPrice 加价
     * @return  bool
     *
     */
    bool intelBidding(1:i64 dealerId, 2:i64 orderId, 3:double basePrice, 4:double addPrice) throws (1:InvalidException ex),

    /**
     * 获取最后智能出价设置信息
     *
     * @param i64 dealerId 车商ID
     * @param i64 orderId 拍单ID
     * @return  LastAutoBiddingInfoMsg
     *
     */
    LastAutoBiddingInfoMsg getLastAutoSetInfo(1:i64 dealerId, 2:i64 orderId) throws (1:InvalidException ex),

    /**
     * 创建拍卖场次
     *
     * @param inParamsCreateScene inParams 建场参数结构
     * @return  bool
     *
     */
    bool createEditScene(1:inParamsCreateEditScene inParams) throws (1:InvalidException ex),

    /**
     * 上拍
     *
     * @param inParamsCreateOrder inParams 上拍参数结构
     * @return  bool
     *
     */
    bool createOrder(1:inParamsCreateOrder inParams) throws (1:InvalidException ex),

    /**
     * 上拍审核
     *
     * @param integer orderId 被审核的拍单ID
     * @param bool result 审核结果(true 通过 false 驳回)
     * @param string reason 驳回原因
     * @param integer empId 审核者
     * @return  bool
     *
     */
    bool auditOrder(1:i64 orderId, 2:bool result, 3:string reason,4:i64 empId) throws (1:InvalidException ex),

    /**
     * 分钟点触发开始
     *
     * @param integer time 时间戳
     * @return  map
     *
     */
    map<i64,OrderSceneMsg> startTrigger(1:i64 time) throws (1:InvalidException ex),

    /**
     * 分钟点触发结束
     *
     * @param integer orderId 时间戳
     * @param bool isForce 是否强制结束
     * @return  bool
     *
     */
    map<i64,OrderSceneMsg> endTrigger(1:i64 orderId,2:bool isForce) throws (1:InvalidException ex),

    /**
     * 竞拍出价处理服务(竞拍出价消费程序调用）
     *
     * @param BiddingMsg biddingMsg
     * @return  bool
     *
     */
    bool biddingDeal(1:BiddingMsg biddingMsg) throws (1:InvalidException ex),


}

